package com.xiangban.yanglaodajie_platform.controller;

import com.xiangban.yanglaodajie_platform.aop.Permission;
import com.xiangban.yanglaodajie_platform.entity.ClassOrActivity;
import com.xiangban.yanglaodajie_platform.entity.dto.ClassOrActivityDto;
import com.xiangban.yanglaodajie_platform.entity.res.ApiResult;
import com.xiangban.yanglaodajie_platform.entity.res.ApiResultCode;
import com.xiangban.yanglaodajie_platform.service.ClassOrActivityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

/**
 * @Author Mr. MaYaYun
 * @Data 2021/5/8 14:14
 */
@RestController
@RequestMapping("/api/v1/pri/class_or_activity")
@Api(tags = "老年学堂活动报名模块")
public class ClassOrActivityController {

    @Autowired
    private ClassOrActivityService classOrActivityService;

    @PostMapping("/getClassOrActivityList")
    @ApiOperation("获取活动列表")
    public ApiResult<Object> getClassOrActivityList(@RequestBody ClassOrActivity classOrActivity){
        return ApiResult.newSuccess(classOrActivityService.getList(classOrActivity));
    }

    @PostMapping("/getClassOrActivityInfo")
    @ApiOperation("获取活动详情")
    public ApiResult<Object> getClassOrActivityInfo(@RequestBody ClassOrActivityDto classOrActivityDto) throws ParseException {
        return ApiResult.newSuccess(classOrActivityService.getInfo(classOrActivityDto));
    }






}
